properties: add "ambiguous_width" property for ambiguous East Asian Width (#270)
authorbfredl <bjorn.linse@gmail.com>
Fri, 30 Aug 2024 16:39:09 +0000 (18:39 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Aug 2024 16:39:09 +0000 (12:39 -0400)
commit3de4596fbe28956855df2ecb3c11c0bbc3535838
treec41c47b787f92f2b00901070abe1d3d5474b6a36
parent5568eff49a6bf417b6fdef2808df9db8d3d68a76
properties: add "ambiguous_width" property for ambiguous East Asian Width (#270)

Some characters have their width defined as "Ambiguous" in UAX#11.
These are typically rendered as single-width by modern monospace fonts,
and utf8proc correctly returns charwidth==1 for these.

However some applications might need to support older CJK fonts where
characters which where two-byte in legacy encodings were rendered as
double-width. An example of this is the 'ambiwidth' option of vim
and neovim which supports rendering in terminals using such wideness
rules.

Add an 'ambiguous_width' property to utf8proc_property_t for such characters.
data/data_generator.jl
test/charwidth.c
utf8proc.c
utf8proc.h
utf8proc_data.c